function ds_sucess(str){//data_save执行成功后 mobile版
//alert("ds_success"+top.document.getElementById('iframe_data_save'));
	parent.document.getElementById('iframe_data_save').src='about:blank';
}


function form_check(){
pass=true;
$(".formtips").remove();  
//alert("d");return;
$("form :input.necessary").each(function(){
if( $(this).val()==""){
$(this).parent().append("<div class='necessary_red formtips onError'>*必填内容</div>");  //$(this).parent().append(necessary); 
pass=false; 
}
    }); 
//alert("here");return false;
return pass;
//if(!pass)return;
}



function show_error(str){//发生错误
layer.msg(  (str==undefined?'数据处理失败，请重试或联系管理员！':str)  ,{shade: 0.3,icon:5,time:0,closeBtn:1,shadeClose:true});
}
function show_message(str){//普通提示
//if(str==undefined)alert("无");
//alert(str==undefined?'数据处理失败，请重试或联系管理员！':str);
layer.msg(  (str==undefined?'数据处理中，请等待！':str) ,{shade: 0.3,icon:0,time:0,closeBtn:1,shadeClose:true});
}
function show_wait(str){//等待处理
layer.msg(  (str==undefined?'数据处理中，请等待！':str),{shade: 0.3,icon:16,time:0});
}
function close_layer(){
layer.closeAll();
}


var saveok_func="";
function save_ok(){ 
top.close_layer();
eval(saveok_func); //调用不同的后续处理代码
}


$(function(){


//$select_id=$("[name='select_id[]']");
$("#select_all").click(function(){//全选/反选
	var isChecked = $(this).prop("checked");
	$("input[name='select_id[]']").prop("checked", isChecked);
}) 

$("input[name='select_id[]']").click(function(){//全选/反选
//alert("d");return;
	//var isChecked = $(this).prop("checked");
	$("#select_all").prop("checked", false);
}) 



$("#button_advance").click(function(){
	// alert(window.location.pathname);return;
	var isChecked = $(this).prop("checked");
	
	if(isChecked)$('#search_tr').show();
	else location.href=window.location.pathname;
	//$("input[name='select_id[]']").prop("checked", isChecked);
}) 


});




//用于改变页面url参数并跳转 
function c(n,v){
	 //alert(n+"/"+v);
var l_f=location.href;
//if(n=="subjectid")l_f=l_f.changeQuery("userid",0);
l_f=l_f.changeQuery(n,v);
 //alert(l_f);
 //return;
location.href=l_f;
	}

function page_change(n){ //将url参数中的order_text,order排序参数置换掉
//alert(n);
//location.href = location.href.changeQuery("order_text",n);
location.href = location.href.changeQuery("page",n);
//alert(abc);
//location.href=abc;
//location.href="?order_text="+nstr+"&order="+str+"<? //=$more_url?>";
}
//修改url参数
String.prototype.changeQuery = function(name,value)
 {
var name_arr=name.split("|");
var value_arr=value.toString().split("|");
var return_str=this;
	 for(var i=0;i<name_arr.length;i++){
var reg = new RegExp("(^|)"+ name_arr[i] +"=([^&]*)(|$)");
if( typeof(value_arr[i])=="undefined")value_arr[i]="";
var tmp = name_arr[i] + "=" + value_arr[i];
//alert(tmp);
  if(this.match(reg) != null)
  {
 // alert("有");
   return_str=return_str.replace(eval(reg),tmp);
  }else{
     if(return_str.match("[\?]"))return_str=return_str + "&" + tmp;
	 else return_str=return_str + "?" + tmp;
  }
	 }
	 return return_str;
 }



//打开新窗口 //n==1时showModalDialog n==0时window.open
 function win_open(n,url,w,h) { 
 var strReturn;

   //if (window.showModalDialog!=null)//IE判断
   if(window.navigator.appName!="Netscape" &&  n==1) //IE
   {
   //showModalDialog("a.php", window, "dialogWidth:577px; dialogHeight:357px; status:0; help:0");
   
  strFeatures="dialogWidth="+w+"px;dialogHeight="+h+"px;center=yes;middle=yes;help=no;status=no;scroll=auto;";
 //   strFeatures="dialogWidt:"+w+"px;dialogHeight:"+h+"px;center:yes;middle:yes;help:no;status:no;scroll:1;";
strReturn=window.showModalDialog(url,window,strFeatures);   

   }else{//firefox 
   strFeatures="width="+w+"px,height="+h+"px,menubar=no,toolbar=no,location=no,status=no,scrollbars=no,modal=yes";
   strFeatures="";
      strReturn=window.open(url,'open_win',strFeatures);   
  }
return strReturn;
} 





function update_content_img(o){//批量修复img的高度，兼容IE等浏览器不支持vw值
//$(".news .content_img")
o.each(function (){	$(this).height($(this).width()*7/12); $(this).parent().height($(this).height());    });
//$(".news").height();
//(function (){	$(this).height($(this).width()*7/12);});
}
$(function() {
//http://my.oschina.net/ffwcn/blog/213708
var isIE = /msie/.test(navigator.userAgent.toLowerCase());
//alert(isIE);
if( isIE ){
//top.show_message("建议您使用Firefox、Chrome、Safari等非IE浏览器进行访问！");
// 如果符合条件，弹出提示，升不升级是他们的选择，我觉得不需要强制。
// 如果一定要强制的话，在这里加一句代码。
//return;
}
		   
		   
$img = $("img");
$img.each(function(){
				
// alert(   $(this).attr("src").indexOf("/Upload/")   );
	if($(this).attr("src").substr(0,8)=="/Upload/"){
		//if($(this).attr("src").indexOf("/Upload/")!=-1){
		
		$(this).width("93%");
	//$(this).attr("sdata-url","http://www.feikehome.com"+$(this).attr("src"));
	//$(this).attr("data-url","http://www.feikehome.com"+$(this).attr("src"));
	//$(this).attr("src","http://www.feikehome.com"+$(this).attr("src"));
	$(this).attr("src","/upfile/fly/"+$(this).attr("src"));
	
}
				   });



$("img").error(function() {
//        $(this).remove();   //1.remove the image
       $(this).attr("src", "/images/nopic.gif");    //2.replace the image
	  
	  // $(this).attr("src", "http://www.feikehome.com:81/"+$(this).attr("sdata-url") );
    });

$(".user_img").error(function() {
 $(this).attr("src", "/images/nouser.jpg");    //2.replace the image
 });

$a_top=$(".a_top");

$news_r=$(".news_r_scroll");
$news_r_w=$news_r.width();
$news_r_offset=$news_r.offset();
//$("#kkk").val($(window).scrollTop()+"/"+$news_r_offset.top);
$load_div=$("#load_div");
$load_div_offset=$load_div.offset();


//$(".wrap_div_img img,.lazy").lazyload({effect : "fadeIn"});	//lazy load	
		update_content_img($(".news .content_img"));
		   $("body").addClass("chang_fontSize");
//屏幕的宽度
	 width_srceen = screen.width ;
	 font_size =  "10";//默认为10px
		$("html").css("-webkit-text-size-adjust"
		,"none");
}); 
$(window).resize(function() { 
//窗口缩放时执行
 //changbody_fontSize(".chang_fontSize");
}); 





var $a_top,$news_r,$news_r_w,$news_r_offset,$load_div,$load_div_offset;
$(window).scroll(function(){
			// alert($(".news_r_scroll").width());		  
	//侧边栏跟随滚动条
	
	
// $("#kkk").val($(window).scrollTop()+"/"+$load_div_offset.top);
	//return;
	if($news_r_offset){
		//if($(window).scrollTop()>$news_r_offset.top)$news_r.css({"position":"fixed",width:$news_r_w,"top":"0px","left":$news_r_offset.left});
		//else $(".news_r_scroll").css({"position":""});
		
		
		
		
//ar fold = $(window).height() + $(window).scrollTop();

//return;
if($(window).scrollTop()>$news_r_offset.top){//头部显示
//		return;

if( $(window).height() + $(window).scrollTop() > $load_div_offset.top){
 	$news_r.css({"position":"absolute","left":"0px","top":"","bottom":"0px"});//more显示
//$("#kkk").val("显示loading"+$news_r.height());
}else{
//alert("kk");
//	$("#kkk").val("固定位置");
 	//$news_r.css({"position":"fixed","left":$news_r_offset.left,"top":"0px"});//more显示
 	$news_r.css({"position":"fixed","width":$news_r_w,"top":"0px","left":$news_r_offset.left});
}

}else{
//	$("#kkk").val("恢复初始化");
 	$(".news_r_scroll").css({"position":""});
}

/*
if( fold > $load_div_offset.top){
$news_r.css({"position":"absolute",width:$news_r_w,"left":"0px","bottom":"0px"});
	  // var $ro = $load_div[0].getBoundingClientRect();
$("#kkk").val("show"+ $ro.bottom );
   }else{
   $news_r.css({"position":"fixed",width:$news_r_w,"top":"0px","left":$news_r_offset.left});
}
	   
*/	   
	   
	   
		
	}
		if($a_top){
    if($(window).scrollTop()>0){    //垂直滚动条钓offset 大于90时。
		$(".a_top").show();
    }else{
$(".a_top").hide();   
}
}

});
var index=0;
var sec=2000;//间隔秒数
var arr={};//控件数组
var n_arr={};//切换项目数组
var int_arr={};//动画数组
var int;	
var loading = false;
var  $wd = $(window);
function auto(i){//动画
// alert(n_arr[i]);

//if( n_arr[i]<0)n_arr[i]
//if( n_arr[i]<0 || isNaN(n_arr[i]) )n_arr[i]=0;
obj=arr[i];
obj.stop(true,true);

//alert(n_arr[i]+"/"+obj.length);

if(n_arr[i]>=obj.length || isNaN(n_arr[i]) ){
//alert("h");
n_arr[i]=0;
}
if(  n_arr[i]<0)n_arr[i]=obj.length-1;
//if( isNaN(n_arr[i]) )n_arr[i]=0;
//$("#kk").val(n_arr[i]);

// alert(i+"/"+n_arr[i]);

obj.hide();
obj.eq(n_arr[i]).fadeIn(1000);
 $pc_a.removeClass("a_banner_foot_hover");
 $pc_a.eq(n_arr[i]).addClass("a_banner_foot_hover");
n_arr[i]++;
}

